
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports _2bMatesSite.BO

Namespace _2bMatesSite
	''' <summary>
	''' Summary description for privacy_settings.
	''' </summary>
	Public Partial Class privacy_settings
		Inherits BaseWebPage
		Protected Label22 As System.Web.UI.WebControls.Label
		Protected Label23 As System.Web.UI.WebControls.Label
		Protected rApproveYes As System.Web.UI.WebControls.RadioButton
		Protected Label24 As System.Web.UI.WebControls.Label
		Protected rApproveNo As System.Web.UI.WebControls.RadioButton

		Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
			' Put user code to initialize the page here
			' this.pageTemplate.PageTitle = PageTitles.PRIVACY_SETTINGS_PAGE;

			Dim usr As User = LoggedUser

			If usr = Nothing Then
				Common.Utils.RedirectToLoginPage(Page)
			End If

			' init page from XML
			Me.initPageTitles(Constants.PRIVACY_SETTINGS, "", Form1, Nothing, Nothing)
			Me.initAdvertisements(Form1, Nothing)

			If Not Me.IsPostBack Then
				If usr.ShowOnline = True Then
					chkNotShowOnline.Checked = False
				Else
					chkNotShowOnline.Checked = True
				End If

				If usr.ApproveComments Then
					chkAlwaysApprove.Checked = False
				Else
					chkAlwaysApprove.Checked = True
				End If

				If usr.ApproveBlogComments Then
					chkAlwaysApproveBlog.Checked = False
				Else
					chkAlwaysApproveBlog.Checked = True
				End If

				If usr.ApproveFriends Then
					chkApproveFriends.Checked = False
				Else
					chkApproveFriends.Checked = True
				End If
			End If

			'btnCancel.Attributes["onclick"] = "javascript: history.back(); return false;";
		End Sub

		#region Web Form Designer generated code
		Protected Overloads Overrides Sub OnInit(ByVal e As EventArgs)
			'
			' CODEGEN: This call is required by the ASP.NET Web Form Designer.
			'
			InitializeComponent()
			MyBase.OnInit(e)
		End Sub

		''' <summary>
		''' Required method for Designer support - do not modify
		''' the contents of this method with the code editor.
		''' </summary>
		Private Sub InitializeComponent()

		End Sub
#End Region

		Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs)
			Dim success As Boolean = False
			Try
				Dim usr As User = LoggedUser
				If Request.Params(chkNotShowOnline.UniqueID) = "on" Then
					usr.ShowOnline = False
				Else
					usr.ShowOnline = True
				End If

				If chkAlwaysApprove.Checked Then
					usr.ApproveComments = False
ElseIf Not chkAlwaysApprove.Checked Then
					usr.ApproveComments = True
				End If

				If chkAlwaysApproveBlog.Checked Then
					usr.ApproveBlogComments = False
ElseIf Not chkAlwaysApproveBlog.Checked Then
					usr.ApproveBlogComments = True
				End If

				If chkApproveFriends.Checked Then
					usr.ApproveFriends = False
ElseIf Not chkApproveFriends.Checked Then
					usr.ApproveFriends = True
				End If

				usr.Save()

				success = True
			Catch generatedExceptionName As Exception
			End Try

			If success = True Then
				lblMessage.Visible = True
			Else
				Response.Redirect(Constants.ERROR_PAGE + "?e=" + Constants.[ERROR])
			End If
		End Sub

		Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs)
			Response.Redirect(Constants.ACCOUNT_SETTINGS_PAGE)
		End Sub

		Protected Sub chkNotShowOnline_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)

		End Sub

		====================
		' This public property was added by conversion wizard to allow the access of a protected, autogenerated member variable Form1.
		====================
		Public ReadOnly Property Form1() As System.Web.UI.HtmlControls.HtmlForm
			Get
				Return Migrated_Form1
			End Get
		End Property
		'set { Migrated_Form1 = value; }
	End Class
End Namespace






